<?php
	class Mailer extends ModuleQuery{		
		
		protected $template 	= '';
		protected $SMTP  		= NULL;
		protected $SWIFT   		= NULL;    	
		protected $RECIPIENTS 	= NULL;				
		protected $SENDER		= '';
		protected $senderEmail 	= 'noReply@website.com';
	
		public function Mailer(){
			
			$this->connect(); 																	  // connect to DB
			$this->SMTP 		=& new Swift_Connection_SMTP("192.168.0.41");	
			$this->SMTP->setUsername("");
    		$this->SMTP->setpassword(""); 
			$this->SWIFT 		=& new Swift($this->SMTP);
			$this->RECIPIENTS 	=& new Swift_RecipientList();	 							 //recipients
			$this->SENDER 		=& new Swift_Address($this->senderEmail,"Project Name");	 // default sender		
		}
		
		public function sendMail($subject, $content){										
			return $this->SWIFT->send(new Swift_Message($subject, $content,"text/html"), $this->RECIPIENTS, $this->SENDER); 				
		}
		
		public function addRecipient($email){		
			$this->RECIPIENTS->addTo($email);    	
		}	
		
		public function addSender($sender){		
			$this->SENDER = $sender;    	
		}

		public function sendLocation($title,$message,$sender){
			
			$mailContent = $message;
			
			$this->addRecipient($email);	
			$this->addSender($sender);
			return $this->sendMail($title, $mailContent);
		}
	}
?>